package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.dto.OrdersPageQueryDTO;
import com.sky.entity.Orders;
import com.sky.vo.OrderPageResult;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.aspectj.weaver.ast.Or;

import java.util.List;

@Mapper

public interface OrderMapper {
    void insert(Orders order);
    /**
     * 根据订单号查询订单
     * @param orderNumber
     */
    @Select("select * from orders where number = #{orderNumber}")
    Orders getByNumber(String orderNumber);

    @Select("select * from orders where id =#{id}")
    Orders getByid(Integer id);

    /**
     * 修改订单信息
     * @param orders
     */
    void update(Orders orders);
    @Update("update orders set status = #{status},cancel_time = #{cancelTime} where id = #{id}")
    void cancel(Orders orders);
    Long gettotals(OrdersPageQueryDTO dto);

    List<Orders> get(OrdersPageQueryDTO dto);

    Page search(OrdersPageQueryDTO dto);
    @Select("select * from orders where status in(2,3,4)")
    List<Orders> getStatistics();
}
